#ifndef CHARTWIDGET_H
#define CHARTWIDGET_H

#include <QtSql>
#include <QtGui>

#include "ui_chartwidget.h"
#include "schema.h"
#include "pieview.h"

class ChartWidget : public QWidget, private Ui::ChartWidget
{
Q_OBJECT

public:

ChartWidget(QString table,
            QString num,
            QString name,
            QString filter,
            QMap<int,int> asc_indicies,
            QMap<int,int> desc_indicies);
~ChartWidget();

public slots:

void new_query(int);

private:

void setup_model();
void setup_view();
void get_data(const QString c);
QColor generate_color(int row);
void populate_model();
QStandardItemModel * model;
QAbstractItemView * pieChart;
QItemSelectionModel * selectionModel;
QMap<QString, double> m;
QStringList l;
QString album;
QFont default_font;
QString filter_;

};

#endif // CHARTWIDGET_H
